import time
from threading import Thread

COUNT = 50000000

def countdown(n):
	while n > 0:
		n -= 1

t1 = Thread(target=countdown, args=(COUNT//2,))
t2 = Thread(target=countdown, args=(COUNT//2,))

start = time.time()
t1.start()
t2.start()
t1.join()
t2.join()
end = time.time()

print('time taken in seconds -', end - start)
'''
muti-thread is bad for CPU-BOUND scenario
This increase is the result of acquire and release overheads added by the lock(GIL)
'''


# single_thread.py
import time
from threading import Thread

COUNT = 50000000

def countdown(n):
	while n>0:
		n -= 1

start = time.time()
countdown(COUNT)
end = time.time()

print('Time taken in seconds -', end - start)
